<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // 用循环求n！.(1*2*3*4....*n)

    // 输入框
    let n = +prompt('请输入一个数：');
    let sum = 1;

    for(let i = 1; i <= n; i++) {
        sum *= i;
    }

    // 求阶乘
    console.log(sum);
</script>
</html>